package me.ZFC.Text;

import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int money;
        while (true) {
            System.out.println("请输入一个金额");
            money = sc.nextInt();
            if (money >= 0 && money <= 1000000) {
                break;
            } else {
                System.out.println("金额输入错误");
            }
        }
        String moneyStr = "";
        while (money != 0) {
            int ge = money % 10;
            String str = getCapitalNumber(ge);
            moneyStr = str + moneyStr;
            money = money / 10;
        }
        int count = 7 - moneyStr.length();
        for (int i = 0; i < count; i++) {
            moneyStr = "零" + moneyStr;
        }
        String[] arr = {"佰", "拾", "万", "仟", "佰", "拾", "元"};
        for (int i = 0; i < moneyStr.length(); i++) {
            System.out.print(moneyStr.charAt(i) + arr[i]);
        }
    }

    public static String getCapitalNumber(int number) {
        String[] arr = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
        return arr[number];
    }
}
